<?php
//https://code.google.com/apis/console/#project:636516852314:services
//API key:	AIzaSyDfYlODWJrm2SRdcjsZdBvVwZ3DMoRL-t8
require_once("../Model/db_GCMUsers.cls.php");
class GCM {
 
    private $clsGCM;
    function __construct() {
         
    	$this->clsGCM = new GCMUsers();
		}
	public function getAllGCM()
	{
		return $this->clsGCM->selectAll();
	}
	public function insertGCM($param)
	{
		if(empty($param))
			return false;
		if($this->clsGCM->isHavingKey($param['gcm_regid'])==0)
		{
			foreach ($param as $key => $value)
			{
				$param[$key] = !empty($param[$key])?$param[$key]:"";
			}
			return $this->clsGCM->insert($param);
		}else if ($this->clsGCM->isHavingKey($param['gcm_regid'])>0)
			return true;
		else
			return false;
	}
	
	public function deleteGCM($ID)
	{
		if(empty($ID))
			return;
		return $this->clsGCM->delete($ID);
	}
	
}
?>